<?php
/**
 * Created by PhpStorm.
 * Author: 芸签cms www.yunqiancms.com
 * User: sun
 * Date: 2022/8/1
 * Time: 1:04 PM
 */
namespace app\common\services\theme\datas;



use app\backend\modules\sys\services\NavService;
use app\common\models\Nav;

class NavMenuList
{
    public function getData($id,$isEdit=false){
        if(!$id){
            return [];
        }
        if($isEdit){
            //后端编辑显示导航数据
            $res = Nav::select(['id','name'])->where('id',$id)->first();
            $res = [$res];//前端要返回数组
        }else{
            $res = (new NavService())->getMenuList(['nav_id'=>$id]);
        }
        return $res;
    }
}
